package com.jt.provider.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ProviderController {
    @Value("${server.port:8080}")
    private String server;
    @GetMapping("/provider/echo/{msg}")
    public String doRestEcho1(@PathVariable("msg") String msg){
        //return server+" say hello "+msg;
        //假如不想执行字符串的拼接,可以采用如下方式
        return String.format("%s say hello %s",server,msg);
        //如上语句中的s%为一个字符串占位符,server,msg的值最后会替换s%
    }
}
